function cekFoto(foto)
{
	var patt=/^.+(?:.jpg)$|.+(?:.bmp)$|.+(?:.jpeg)$|.+(?:.png)$/
	if(patt.test(foto))
	{
	  document.getElementById("CekPicture").innerHTML = "";   //set error mark
		return true;}
	else
	{
	  document.getElementById("CekPicture").innerHTML = "(!!!)";   //set error mark
		alert("File Type Not valid");
		return false;
	}	
}

function cekDesc(desc)
{
	var patt = /^.{5,}$/;
	if(patt.test(desc))
	{
	  document.getElementById("CekDescription").innerHTML = "";   //set error mark
		return true;}
	else
	{
	  document.getElementById("CekDescription").innerHTML = "(!!!)";   //set error mark
		alert("Description Not valid");
		return false;
	}
}

function cekPwd(pwd)
{
    var patt = /^.{3,}$/;
	if(patt.test(pwd))
	{
	  document.getElementById("CekPassword").innerHTML = "";   //set error mark
		return true;}
	else
	{
	  document.getElementById("CekPassword").innerHTML = "(!!!)";   //set error mark
		alert("Password Not valid");	
		return false;
	}
}

function cekTanggal(pdate)
{
	var patt=/^\d{4}[-]([0](?:[0-9])|[1](?:[012]))[-]([012](?:[0-9])|[3](?:[01]))$/
	if(patt.test(pdate))
	{
	  document.getElementById("CekDate").innerHTML = "";   //set error mark
		return true;}
	else
	{
	  document.getElementById("CekDate").innerHTML = "(!!!)";   //set error mark
		alert("Date Not Valid");
		return false;
	}	
}

function cekAll()
{
    var foto = (document.getElementById('foto')).value   ;
    var desc = (document.getElementById('desc')).value   ;
    var pwd = (document.getElementById('pwd')).value   ;
    var pdate = (document.getElementById('pdate')).value   ;
	
	var a = cekFoto(foto);
	var b = cekDesc(desc);
	var c = cekPwd(pwd);
	var d = cekTanggal(pdate);
	
	if(a && b && c && d)
		alert("Submitted");
	else
		alert("Not Submitted");
	
}